﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StockTransferCtrl.ascx.cs"
    Inherits="WebUI.Controls.StockTransferCtrl" %>
    
<script type="text/javascript">
    function isNumeric(value) {
        if (value != null && !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
            return true;
    }

    var IMEILength = <%= WebUI.BasePage.SysVars.IMEILength %>;
    function txtIMEI_onchange(txt) {
        if(!isNumeric(txt.value)){
            alert("Invalid IMEI number!");
            txt.value = "";
            return;
        }
        
        if(txt.value.length >= IMEILength){
            document.getElementById("<%=btnAddIMEI.ClientID %>").click();
            txt.value='';
        }
    }       

    function focusIMEI(){
        document.getElementById('<%= txtIMEI.ClientID %>').focus();
    }
</script>
<asp:Panel ID="mainPanel" runat="server" CssClass="primaryFrameNoBorder">
    <table width="100%">
        <tr>
            <td style="text-align: left; vertical-align: top;">
                <asp:Label ID="Label1" runat="server" Text="Stock Location:" class='labelMessage'></asp:Label><br />
                <asp:DropDownList ID="ddlLocation" runat="server" Width="100%">
                </asp:DropDownList>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td style="text-align: left; vertical-align: top; width:100%">
                <asp:Panel ID="panelIMEI" runat="server" DefaultButton="btnAddIMEI">
                    <asp:Label ID="lblIMEI" runat="server" Text="IMEI/Serial:" class='labelMessage'></asp:Label><br />
                    <asp:TextBox ID="txtIMEI" runat="server" Width="98%" onfocus='this.select();' ></asp:TextBox><br />
                    <asp:Label class="labelNote" Text="(*) Scan and press Enter." runat="server" ID="label2"></asp:Label>
                </asp:Panel>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td style="text-align: left; vertical-align: top">
                <table class="toolbar" width="100%">
                    <tr>
                        <td>
                            <asp:LinkButton class="tbbutton" ID="btnDelete" runat="server" ToolTip="Delete selected IMEI" OnClick="btnDelete_Click">
                                <img src="~/Images/Delete.gif" runat="server" style='vertical-align: middle' /><asp:Label ID="label7"
                                    class='labelMessage' runat="server" Text="Delete" ></asp:Label>
                            </asp:LinkButton>
                            <asp:LinkButton class="tbbutton" ID="btnClear" runat="server" ToolTip="Clear all" OnClick="btnClear_Click">
                                <img src="~/Images/edit-clear.png" runat="server" style='vertical-align: middle' /><asp:Label
                                    ID="label3" class='labelMessage' runat="server" Text="Clear" ></asp:Label>
                            </asp:LinkButton>
                        </td>
                    </tr>
                </table>
                <asp:ListBox ID="lstIMEI" runat="server" Height="200px" Width="100%"></asp:ListBox>
            </td>
            <td>
                
            </td>
        </tr>
        <tr style="text-align: center; vertical-align: top">
            <td>
                <asp:Button ID="btnTransfer" ValidationGroup="Save" OnClick="btnTransfer_Click" runat="server"
                    Text="Transfer" ToolTip="Transfer all IMEI to selected Stock Location" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblMessage" runat="server" class="labelMessage"></asp:Label>
            </td>
        </tr>
    </table>
    <asp:Button Style="display: none" ID="btnAddIMEI" runat="server" OnClick="btnAddIMEI_Click" />
</asp:Panel>
